﻿Imports System.Data.OleDb

Public Class dealrequestdetail
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub b_Comment_Click(ByVal sender As Object, ByVal e As EventArgs) Handles b_Comment.Click


        Dim qs As String
        qs = "1"

        If Not (Request.QueryString("id") Is Nothing) Then
            qs = Request.QueryString("id")
        End If

        Dim sql As String = "INSERT INTO Comments (Author,Title,Commentbody,Deal_fkID, table_ID) VALUES (@f1,@f2,@f3,@f4,@f5)"
        Dim conn As OleDbConnection = New OleDbConnection(ConfigurationManager.ConnectionStrings("DealsDbConnection").ConnectionString)
        Dim cmd As OleDbCommand = New OleDbCommand(sql, conn)
        cmd.Parameters.AddWithValue("@f1", User.Identity.Name)
        cmd.Parameters.AddWithValue("@f2", tb_title.Text)
        cmd.Parameters.AddWithValue("@f3", tb_cb.Text)
        cmd.Parameters.AddWithValue("@f4", qs)
        cmd.Parameters.AddWithValue("@f5", 2)
        conn.Open()
        cmd.ExecuteNonQuery()
        conn.Close()
        cmd.Dispose()
        conn.Dispose()
        GridView1.DataBind()

    End Sub
End Class